const protobuf = require('protocol-buffers');
const fs = require('fs');
const schema = protobuf(fs.readFileSync(__dirname + '/test.proto', 'utf-8'));

console.log(schema);
/*
Messages {
  Column:
   { type: 2,
     message: true,
     name: 'Column',
     buffer: true,
     encode: { [Function: encode] bytes: 0 },
     decode: { [Function: decode] bytes: 0 },
     encodingLength: [Function: encodingLength],
     dependencies: [ [Object], [Object], [Object] ] } }
*/
const buffer = schema.Column.encode({
  id: 1,
  name: 'Node.js',
  price: 80.4
});
console.log(buffer); // <Buffer 08 01 12 07 4e 6f 64 65 2e 6a 73 1d cd cc a0 42>
console.log(schema.Column.decode(buffer)); // { id: 1, name: 'Node.js', price: 80.4000015258789 }
